package com.ymx.darling.bean.entity;

import com.ymx.darling.logicdelete.LogicDeleteProcessor;
import com.ymx.darling.type.TypeHandler;
import com.ymx.darling.bean.entity.id.IdType;

import java.lang.reflect.Field;

/**
 * 字段信息封装
 * @author 爱Java的小于
 */
public class FieldContent implements FieldInfo {
    private String property;
    private String column;
    private IdType idType;
    private Field field;
    private String keySequence;
    private TypeHandler<?> typeHandler;
    private LogicDeleteProcessor logicDeleteProcessor;

    public String getProperty() {
        return property;
    }

    public void setProperty(String property) {
        this.property = property;
    }

    public String getColumn() {
        return column;
    }

    public void setColumn(String column) {
        this.column = column;
    }

    public void setIdType(IdType idType) {
        this.idType = idType;
    }

    public IdType getIdType() {
        return idType;
    }

    public void setKeySequence(String keySequence) {
        this.keySequence = keySequence;
    }

    public String getKeySequence() {
        return keySequence;
    }

    public Field getField() {
        return field;
    }

    public void setField(Field field) {
        this.field = field;
    }

    public void setTypeHandler(TypeHandler<?> typeHandler) {
        this.typeHandler = typeHandler;
    }

    public TypeHandler<?> getTypeHandler() {
        return typeHandler;
    }

    public void setLogicDeleteProcessor(LogicDeleteProcessor logicDeleteProcessor) {
        this.logicDeleteProcessor = logicDeleteProcessor;
    }

    public LogicDeleteProcessor getLogicDeleteProcessor() {
        return logicDeleteProcessor;
    }

    @Override
    public boolean equals(Object obj) {
        if (!(obj instanceof FieldContent)) {
            return false;
        }
        return obj == this || ((FieldContent)obj).getField() == this.field;
    }
}
